﻿// See https://aka.ms/new-console-template for more information
using System;

namespace randomInt
{
   class Program
    {
        static void Main(string[] args)
        {
            int[] tmp = new int[100];
            Random random= new Random();
            for (int i = 0; i < 100; ++i)
            {
                tmp[i] = random.Next(0,1001);
            }
            var nums = 
                        from n in tmp
                        orderby n descending
                        select n;
            int sum = nums.Sum();
            double ave = nums.Average();
            foreach (int i in nums)
            {
                Console.Write("{0} ", i);
            }
            Console.WriteLine();
            Console.WriteLine(sum);
            Console.WriteLine(ave);
        }
    }
}
